/*
 * @Description: 描述信息
 * @Version: 版本号
 * @Author: xuebao
 * @Date: 2023-12-11 12:14:25
 * @LastEditors: xuebao
 * @LastEditTime: 2023-12-13 20:52:07
 */
import request from "@/utils/request";

import { DashBoard, Login, ResultData, User, Dept, Menu } from "@/types/api";

export default {
  //登陆
  login(params: Login.params) {
    return request.post<string>('/users/login', params, { showLoading: false, })
  },
  //获取用户信息
  getUserInfo() {
    return request.get<User.UserItem>('/users/getUserInfo')
  },
  //获取权限列表
  getPermissionList() {
    return request.get<{ buttonList: string[], menuList: Menu.MenuItem[] }>('/users/getPermissionList')
  },
  //获取工作台汇总数据
  getReportData() {
    return request.get<DashBoard.ReportData>('/order/dashboard/getReportData')
  },
  //获取折线图数据
  getLineData() {
    return request.get<DashBoard.LineData>('/order/dashboard/getLineData')
  },
  //获取城市分布数据
  getPieCityData() {
    return request.get<DashBoard.PieData[]>('/order/dashboard/getPieCityData')
  },
  //获取年领分布数据
  getPieAgeData() {
    return request.get<DashBoard.PieData[]>('/order/dashboard/getPieAgeData')
  },
  //获取雷达图
  getRadarData() {
    return request.get<DashBoard.RadarData>('/order/dashboard/getRadarData')
  },
  //获取用户列表
  getUserList(params: DashBoard.Params) {
    return request.get<ResultData<User.UserItem>>('/users/list', params)
  },
  //创建用户
  createUser(params: DashBoard.CreateParams) {
    return request.post<ResultData<User.UserItem>>('/users/create', params)
  },
  //编辑用户
  editUser(params: DashBoard.EditParams) {
    return request.post<ResultData<User.UserItem>>('/users/edit', params)
  },
  //删除和批量删除用户
  delUser(params: { userIds: number[] }) {
    return request.post('/users/delete', params)
  },
  //部门管理
  getDeptList(params?: Dept.Params) {
    return request.get<Dept.DeptItem[]>('/dept/list', params)
  },
  //获取当前账号下所有用户
  getAllUserList() {
    return request.get<User.UserItem[]>('/users/all/list')
  },
  //创建部门
  createDept(params: Dept.CreateParams) {
    return request.post('/dept/create', params)
  },
  //编辑部门
  editDept(params: Dept.EditParams) {
    return request.post('/dept/edit', params)
  },
  //删除部门
  deleteDept(params: Dept.DelParams) {
    return request.post('/dept/delete', params)
  },
  //菜单管理
  getMenuList(params?: Menu.Params) {
    return request.get<Menu.MenuItem[]>('/menu/list', params)
  },
  //创建菜单
  createMenu(params: Menu.CreateParams) {
    return request.post('/menu/create', params)
  },
  //编辑菜单
  editMenu(params: Menu.EditParams) {
    return request.post('/menu/edit', params)
  },
  //删除菜单
  deleteMenu(params: Menu.DelParams) {
    return request.post('/menu/delete', params)
  },

  //

}
